const {
    mysql,
    localStorage
} = require("./require");

let qx = {
    pbulic_qx(id) {

        return new Promise((resolve, reject) => {
            mysql.query("SELECT * FROM `role_qx` WHERE user_id= ? AND qx in (1,2,3,4,5)", [id], (err, doc) => {
                if (err) {
                    reject(err)
                }
                let data = doc.map(x => {
                    return x.qx
                })
                let role_name = doc.map(x => {
                    return x.role_name
                })
                localStorage.setItem("qx", data)
                localStorage.setItem("role_name", role_name)
                resolve(data);
            })

        })
    }
}
module.exports = qx